class Tweeter #:nodoc:
  include MongoMapper::Document
  
  key :twitter_id, Integer
  key :name, String
  key :screen_name, String
  key :suspended, Boolean, :default=> false
  key :following, Boolean, :default=> true
  key :follower, Boolean, :default=> false
  key :unfollowed, Boolean, :default=> false
  key :sent_dm, Boolean, :default=> false
  key :followed_on, Time
  key :keyword, String
  key :tweet, String
  key :tweet_id, Integer
  key :geo, String
  key :location, String

  key :url, String
  key :description, String
  key :followers_count, String
  key :friends_count, Integer

  validates_presence_of :twitter_id
  
  belongs_to :account
  
  before_save :set_defaults
  
  def set_defaults
    #self.name = self.name.titlecase
    if self.followed_on == nil
      self.followed_on = Time.now
    end
    if self.screen_name == nil
      self.screen_name = ""
    end
  end
  
  def to_s
    return self.to_yaml
  end
end